<%@ page language="java" import="java.util.*,java.io.*" pageEncoding="UTF-8"%>

<%
String path = request.getContextPath();
String basePath = request.getScheme()+"://"+request.getServerName()+":"+request.getServerPort()+path+"/";
%>

<!DOCTYPE HTML PUBLIC "-//W3C//DTD HTML 4.01 Transitional//EN">
<html>
  <head>
    <base href="<%=basePath%>">
    
    <title>My JSP 'filetest.jsp' starting page</title>
    
	<meta http-equiv="pragma" content="no-cache">
	<meta http-equiv="cache-control" content="no-cache">
	<meta http-equiv="expires" content="0">    
	<meta http-equiv="keywords" content="keyword1,keyword2,keyword3">
	<meta http-equiv="description" content="This is my page">
	<!--
	<link rel="stylesheet" type="text/css" href="styles.css">
	-->

  </head>
  
  <body>
    <% File file=new File("c:/","1");
    	file.mkdir();
    	File f=new File(file,"hello.txt");
    	try
    	{	FileOutputStream outfile=new FileOutputStream(f);
    		BufferedOutputStream buffout=new BufferedOutputStream(outfile);
    		byte b[]="很高兴看到你！".getBytes();
    		out.print("<br/>Nice to meet you");
    		buffout.write(b);
    		buffout.flush();
    		buffout.close();
    		outfile.close();
    		FileInputStream infile=new FileInputStream(f);
    		BufferedInputStream buffin=new BufferedInputStream(infile);
    		byte c[]=new byte[90];
    		int n=0;
    		while((n=buffin.read(c))!=-1)
    		{
    			String temp=new String(c,0,n);
    			out.print(temp);
    			
    		}
    		buffin.close();
    		infile.close();
    	}
    	catch(Exception e){}
    %>
  </body>
</html>
